home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / misc / TCS.lha / TCS / examples / sources / SvRGBxPal.s < prev    next >
Text File  |  2000-04-13  |  3KB  |  112 lines

  1. *******************************************************************************
  2. * SaveRGBxPal.s 0.0.0
  3. *******************************************************************************
  4. * INFO    this little tool saves to file the IFF palette of the desired
  5. *    RGBx mode; optionally, you can assign the RGB value you prefer
  6. *    to the color that would look bad in Dual Cross Playfield mode,
  7. *    given a certain transparent color;
  8. * NOTE    - for command line arguments look at the template definition
  9. *      at the bottom
  10. *******************************************************************************
  11.  
  12.     machine    68020
  13.  
  14.     include    INCLUDES:libraries/tcs.i
  15.     include    INCLUDES:libraries/tcs_lib.i
  16.  
  17.     macro    CALLTCS
  18.     movea.l    _TCSBase,a6
  19.     jsr    (_LVOTCS_\1,a6)
  20.     endm
  21.  
  22.  
  23.  
  24.     code
  25.  
  26. *******************************************************************************
  27. * open libs / command line parsing
  28.  
  29.     movea.l    4.w,a6
  30.     lea.l    DOSNm,a1
  31.     moveq.l    #37,d0
  32.     jsr    (-552,a6)    ;OpenLibrary(...)
  33.     move.l    d0,_DOSBase
  34.     beq    .exit
  35.     lea.l    GfxNm,a1
  36.     moveq.l    #37,d0
  37.     jsr    (-552,a6)    ;OpenLibrary(...)
  38.     move.l    d0,_GfxBase
  39.     beq    .ClsDOS
  40.     lea.l    TCSNm,a1
  41.     moveq.l    #1,d0
  42.     jsr    (-552,a6)    ;OpenLibrary(...)
  43.     move.l    d0,_TCSBase
  44.     beq.s    .ClsGfx
  45.  
  46.     move.l    #tmplt,d1
  47.     move.l    #CmdLnArgs,d2
  48.     moveq.l    #0,d3
  49.     movea.l    _DOSBase,a6
  50.     jsr    (-798,a6)    ;ReadArgs(tmplt,CmdLnArgs,0)
  51.     move.l    d0,_RDArgs
  52.     beq    .ClsLibs
  53.  
  54. *******************************************************************************
  55. * main
  56.  
  57.     lea.l    CmdLnArgs,a1
  58.     moveq.l    #0,d1
  59.     moveq.l    #0,d2    ;no Dual Cross Playfield
  60.     moveq.l    #0,d3    ;palette as default
  61.     movea.l    (a1),a0    ;file name pointer
  62.     move.l    ([4.w,a1]),d0    ;RGBx mode
  63.     tst.l    (8,a1)
  64.     sne.b    d1    ;set flag for Dual
  65.     extb.l    d1    ;Cross Playfield palette
  66.     beq.s    .SvPal    ;if no transparent color...
  67.     move.l    ([8.w,a1]),d2    ;get transparent color
  68.     move.l    ([12.w,a1]),d3    ;get dummy RGB value
  69.  
  70. .SvPal    CALLTCS    SvIFFRGBxPal    ;save IFF palette
  71.     beq.s    .out
  72.  
  73. *******************************************************************************
  74. * cleanup / exit
  75.  
  76. .out    move.l    _RDArgs,d1
  77.     movea.l    _DOSBase,a6
  78.     jsr    (-858,a6)    ;FreeArgs(_RDArgs)
  79.  
  80. .ClsLibs    movea.l    4.w,a6
  81.     movea.l    _TCSBase,a1
  82.     jsr    (-414,a6)    ;CloseLibrary(...)
  83. .ClsGfx    movea.l    4.w,a6
  84.     movea.l    _GfxBase,a1
  85.     jsr    (-414,a6)    ;CloseLibrary(...)
  86. .ClsDOS    movea.l    4.w,a6
  87.     movea.l    _DOSBase,a1
  88.     jsr    (-414,a6)    ;CloseLibrary(...)
  89.  
  90. .exit    moveq.l    #0,d0
  91.     rts
  92.  
  93.  
  94.  
  95. *******************************************************************************
  96. * data
  97.  
  98.     cnop    0,4
  99.  
  100. _DOSBase    dc.l    0
  101. _GfxBase    dc.l    0
  102. _TCSBase    dc.l    0
  103. _RDArgs    dc.l    0
  104.  
  105. CmdLnArgs    ds.l    4    ;command line arguments pointers
  106.  
  107. DOSNm    dc.b    "dos.library",0
  108. GfxNm    dc.b    "graphics.library",0
  109. TCSNm    TCSNAME
  110.  
  111. tmplt    dc.b    "IFF=I/A,RGBxMODE=R/A/N,TRNSPCOL=T/K/N,DUMMYRGB=D/K/N",0
  112.